<?php


namespace app\controller\api;


use think\App;
use think\db\exception\DbException;
use think\facade\Db;

class Test extends Base
{
    public function index(){
        $list = Db::table("store_car")->field("id,current_city_id")->select();
        foreach($list as $k =>&$v){
            $id = $v['id'];
            $fa_area = Db::connect("fast_mysql")->table("fa_area")->where(['id'=>$v['current_city_id']])->find();
            if($fa_area){
                Db::table("store_car")->where("id=$id")->update(['current_province_id' => $fa_area['pid'],'current_country'=>$fa_area['country']]);
            }
        }
    }
}